package com.nubia.service;


import com.nubia.dao.AdminDao;
import com.nubia.dao.CartDao;
import com.nubia.entity.Shops;
import com.nubia.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class AdminServiceImpl implements AdminService {
    @Autowired
    AdminDao adminDao;


    /**
     * 查看用户列表
     */
    @Override
    public List<User> adminFindAllUser() {
        return adminDao.adminSelectAllUser();
    }

    /**
     * 管理员删除用户通过id
     */
    @Override
    public int delUserById(User user) {
        return adminDao.adminDleById(user);
    }

    /**
     * 管理员查看商品列表
     */
    @Override
    public List<Shops> adminFindAllShops() {
        return adminDao.adminSelectAllShops();
    }


    /**
     *添加一条商品
     */
    @Override
    public int adminInsShop(Shops shops) {
        return adminDao.adminInsertOneShop(shops);
    }
    /**
     * 删除商品
     */
    @Override
    public int adminDleShop(String shop_id) {
        return adminDao.adminDltShop(shop_id);
    }
    /**
     * 修改商品
     */
    @Override
    public int adminUpdShop(Shops shops) {
        return adminDao.adminUpdShop(shops);
    }
}
